<template>
  <div class="webMoment">
    <div class="moment-top">
      <div class="m-t-left">
        <p>通知：密码重置功能已恢复!</p>
      </div>
      <div class="m-t-right">
        <router-link to="/home/donation">捐助吾志</router-link>
        <!-- <a href="javascript:;">有趣的</a> -->
        <router-link to="/message">每日一文</router-link>
      </div>
    </div>
    <div class="moment-list">
      <div class="list">
        <ul>
          <li v-for="item,index in imgList" :key="item.id">
            <a href="javascript:;">
              <img @click="getUserMsg(index)" :src="`${item.imgurl}`" alt="" />
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Moment",
  data() {
    return {
      imgList: [],
    };
  },
  methods:{
    getUserMsg(v){
      let userEmail = this.$store.state.userEmail;
      if (userEmail == null) {
        alert("请登录")
        this.$store.state.loginStr = "请登录";
        this.$store.state.noLogin = true;
        this.$router.push({path:"/home/login"})
        return false;
      }
      this.$store.state.UserMsg.index = v;
      this.$router.push({path:"/home/userdiary"})
    }
  },
  mounted() {
    axios.get("imgUrl.json").then((res) => {
      //   console.log(res.data);
      this.imgList = res.data;
    });
  },
};
</script>

<style lang="less" scoped>
.webMoment {
  width: 100%;
  .moment-top {
    display: flex;
    justify-content: space-between;
    height: 50px;
    align-items: center;
    .m-t-left {
      color: #808080;
    }
    .m-t-right {
      a {
        color: #4b8dc5;
        font-size: 14px;
        margin: 0 8px;
        &:nth-of-type(1) {
          color: red;
          font-weight: bold;
        }
      }
    }
  }
  .moment-list {
    width: 100%;
    .list {
      width: 100%;
      ul {
        display: flex;
        justify-content: space-between;
        align-items: center;
        align-content: flex-start;
        flex-wrap: wrap;
        li {
          width: 150px;
          height: 150px;
          margin-bottom: 20px;
          a {
            display: block;
            width: 100%;
            height: 100%;
            box-shadow: 1px 1px 2px 3px #ececec;
            padding: 0 3px 3px 0;
            box-sizing: border-box;
            img {
              width: 100%;
              border-radius: 5px;
            }
          }
        }
      }
    }
  }
}
</style>